package com.eric.demoMybatis.test;

import java.io.IOException;
import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.eric.demoMybatis.domain.Student;
import com.eric.demoMybatis.mapper.StudentMapper;

public class DemoTest2 {
	public static void main(String[] args) throws IOException {
		String resource = "mybatis-conf2.xml";
		InputStream inputStream = Resources.getResourceAsStream(resource);
		SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
		SqlSession session = sessionFactory.openSession();
		
		String statement = "com.eric.demoMybatis.studentMapper.getStudent";
		
		Student student = session.selectOne(statement,1);
		System.out.println(student);
		session.close();
	}
}
